#include <stdlib.h>
#include <uuid/uuid.h>

#define NIT_SHORT_NAMES
#include <nit/macros.h>
#include <nit/palloc.h>
#include <nit/list.h>

#include "des.h"
#include "cell.h"
#include "rel.h"

Inb_rel *
inb_rel_new(uuid_t id, void *sub)
{
	Inb_rel *rel;
	Inb_des *des = inb_palloc(rel);

	pcheck(rel, NULL);
	des->type = REL;
	des->flags = INB_FREE;
	rel = inb_thing(des);

	if (id)
		uuid_copy(rel->id, id);
	else
		uuid_generate(rel->id);

	rel->sub = sub;
	return rel;
}
